<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue中组件参数校验与非props特性</title>
    <script src="../vue.js"></script>
   
</head>
<body>
    <div id="app">  
           <child :content="123"></child>
    </div>   
    
    <script>
      
            // 非props 特性
            //1.父组件传  ，子组件不接
            //2. 对应的属性值会显示在外层的html中
        Vue.component('child',{
            props:{
                //  数组形式
                //content: [ Number, String]
                // 对象形式
                content: {
                    type: String,
                    // required: true,
                    // default: 'default',
                    validator: function(value){
                        return (value.length > 5)
                    }
                }
            },
            template: '<div>{{content}}</div>'
        })
    
        var root = new Vue({
            el: '#app',
           
        });
    </script>
</body>
</html>